package com.hzhr.iot.collect.constant;

public enum TransferDirEnum {
	/**
	 * 服务器发起
	 */
	SERVER_BEGIN(10000060, 0),
	/**
	 * 设备发起
	 */
	DEVICE_BEGIN(10000071, 1);
	
	private int id;
	private int idForMessage;
	private TransferDirEnum(int id, int idForMessage) {
		this.id = id;
		this.idForMessage = idForMessage;
	}
	
	public int getId() {
		return id;
	}
	public int getIdForMessage() {
		return idForMessage;
	}
	
	public static TransferDirEnum getEnumByIdForMessage(int idForMessage) {
		for (TransferDirEnum value : TransferDirEnum.values()) {
			if (value.getIdForMessage() == idForMessage) {
				return value;
			}
		}
		return null;
	}
	
	public static TransferDirEnum getEnumById(int id) {
		for (TransferDirEnum value : TransferDirEnum.values()) {
			if (value.getId() == id) {
				return value;
			}
		}
		return null;
	}

	public static TransferDirEnum getEnumByEnumName(String enumName) {
		for (TransferDirEnum value : TransferDirEnum.values()) {
			if (value.toString().equals(enumName)) {
				return value;
			}
		}
		return null;
	}
}
